package com.cjl.multi_thread.share_cooperate.lock;


public class TestWaitNotify {
    private static Empress empress = new Empress();

    private static EmpressLockCondition empressLockCondition = new EmpressLockCondition();

    private static class CheckKm extends Thread{
        @Override
        public void run() {
            empress.checkKm();
        }
    }

    private static class CheckState extends Thread{
        @Override
        public void run() {
            empress.checkState();
        }
    }

    private static class CheckKm2 extends Thread{
        @Override
        public void run() {
            empressLockCondition.checkKm();
        }
    }

    private static class CheckState2 extends Thread{
        @Override
        public void run() {
            empressLockCondition.checkSite();
        }
    }

    public static void main(String[] args) throws InterruptedException {
//        for (int i = 0; i < 3; i++) {
//            new CheckState().start();
//        }
//        for (int i = 0; i < 3; i++) {
//            new CheckKm().start();
//        }
//
//        Thread.sleep(1000);
//        empress.changeKm();


        for (int i = 0; i < 3; i++) {
            new CheckKm2().start();
        }
        for (int i = 0; i < 3; i++) {
            new CheckState2().start();
        }

        Thread.sleep(500);
        empressLockCondition.changeSite();

    }
}
